/**
 * 获取云服务空间provider
 */
const providerFromType = (type) => {
	switch (type){
		case '腾讯云':
			return 'tencent'
		case '阿里云':
			return 'aliyun'
		case '支付宝云':
			return 'alipay'
		default:
			break
	}
}

// 获取创建云服务空间的必要信息
const getSpaceBase = (cloudObj) => {
	const {type, spaceId, endpoint, clientSecret, spaceAppId, accessKey, secretKey} = cloudObj
	return {
		spaceId, provider: providerFromType(type),
		// 下面两项是阿里云必须
		endpoint, clientSecret,
		// 下面三项是支付宝云必须
		spaceAppId, accessKey, secretKey
	}
}

module.exports = getSpaceBase